package leetcode.trietree;

import leetcode.trietree.common.TrieTreeUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

class Solution139 {

    /**
     * 1 <= s.length <= 300
     * 1 <= wordDict.length <= 1000
     * 1 <= wordDict[i].length <= 20
     * s 和 wordDict[i] 仅有小写英文字母组成
     * wordDict 中的所有字符串 互不相同
     *
     * @param s
     * @param wordDict
     * @return
     */
    public boolean wordBreak(String s, List<String> wordDict) {
        return TrieTreeUtils.wordBreak(s, wordDict);
    }
}

public class leetcode139 {
    public static void main(String[] args) {

        Solution139 solution139 = new Solution139();

        String[] wordDict = {"leet", "code"};
        String[] wordDict1 = {"apple", "pen"};
        String[] wordDict2 = {"cats", "dog", "sand", "and", "cat"};
        System.out.println(solution139.wordBreak("leetcode", new ArrayList<>(Arrays.asList(wordDict))));
        System.out.println(solution139.wordBreak("applepenapple", new ArrayList<>(Arrays.asList(wordDict1))));
        System.out.println(solution139.wordBreak("catsandog", new ArrayList<>(Arrays.asList(wordDict2))));

    }

}
